#ifndef JTOUCH_P_H
#define JTOUCH_P_H

#include <QWidget>
#include <QPointer>
#include <QTECore/qteglobal.h>
#include <QTECore/jsingleton.h>

namespace QTE
{

class Q_DECL_HIDDEN TouchFilter : public QObject
{
	Q_OBJECT
	J_PERMANENT_SINGLETON(TouchFilter)

Q_SIGNALS:
	void pressMenu();

protected:
	void timerEvent(QTimerEvent *event) override;
	bool eventFilter(QObject *watched, QEvent *event) override;

private:
	void setInputWidget(QWidget *widget);
	void cancelInputWidget();

private:
	QWidget *m_currInputWidget = nullptr;
	int m_timerID = -1;

	bool m_isPressed = false;
	bool m_touch = false;

	QPointer<QWidget> m_lastObject {nullptr};
};

} //namespace QTE


#endif //JTOUCH_P_H
